package com.ukao.steward.adapter;

import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.widget.TextView;

import com.ukao.steward.R;
import com.ukao.steward.base.ListBaseAdapter;
import com.ukao.steward.base.SuperViewHolder;
import com.ukao.steward.bean.BatchClothingBean;

import java.util.List;

/**
 * Created by kefu001 on 2018/4/27.
 */

public class BatchGoodsAllAdapter extends ListBaseAdapter<BatchClothingBean> {
    public static final int SHOW_ACCESSORY = 2;  //代表显示附件
    public BatchGoodsAllAdapter(Context context, List<BatchClothingBean> mDataList) {
        super(context, mDataList);

    }

    @Override
    public int getLayoutId() {
        return R.layout.adapter_to_shop_goods_list;
    }

    @Override
    public void onBindItemHolder(SuperViewHolder holder, int position) {
        TextView tvOddNumbers = (TextView) holder.getView(R.id.odd_numbers);
        TextView tvAccessory = (TextView) holder.getView(R.id.accessory);
        TextView tvName = (TextView) holder.getView(R.id.product_name);
        TextView tvStatus = (TextView) holder.getView(R.id.status);
        BatchClothingBean clothingBean =mDataList.get(position);
        tvOddNumbers.setText(String.valueOf(clothingBean.getScanCode()));
        tvName.setText(clothingBean.getProductName());
        if (clothingBean.getOrderProType() == SHOW_ACCESSORY) {
            tvAccessory.setVisibility(View.VISIBLE);
        }
        //设置状态text颜色
        if(clothingBean.getStoreStatus()==0){  //未核对
            tvStatus.setTextColor(Color.parseColor("#c6c6c6"));
            tvStatus.setText("未核对");
        }else {
            tvStatus.setTextColor(Color.parseColor("#3db930"));
            tvStatus.setText("已核对");
        }


    }
}
